Skip to main content

Data Modeling

supOS boasts of its data modeling based on the concept of UNS (Unified Namespace). Through building data models according to its hierarchy, meanwhile automatically generating MQTT topics with the same name, data can be easily retrieved in real time.

info

Data models under UNS are empty structures with mock data connected through SourceFlow, follow the order displayed in the image to complete the data flow.

tip
  • SourceFlow and EventFlow are based on NodeRed. For detailed instructions, please see NodeRed.
  • Dashboards is based on Grafana. For detailed instructions, please see Grafana.

Building Data Model

Based on simple folder-file structure, you can define the data hierarchy to a tree map.

info

Factory/workshop/equipment/CNC will be used as an example to demenstrate the process of building data models.

  1. Log in to supOS, and then select UNS > Namespace.
  2. Under Model, click to add a folder (namespace).
  • Template: You can select a template to inherit attributes from it. See Building Template.
  • Generate Template: Click to add an attribute to the folder, at the same time you can select to generate a same template for future use.
info

Apply the same operation, add a folder workshop under Factory, and folder equipment under workshop.

  1. Select equipment, and then click to add a file (data tag) under it.
  • Data Type
TypeDescription
Time SeriesReceive real-time data and store it in TDEngine.
RelationalReceive relational data and store it in a Postgres database.
CalculationPerform basic calculations on the added time series attributes.
AggregationAggregate the added data sources into JSON at a fixed frequency.
  • Attribute Generation Method
    • Custom: Customize attributes.
    • Template: Inherit attributes from the selected template.
    • Reverse Generation: Use JSON text or connected databases to generate attributes with the same structure.
    info

    You can connect databases under DevTools > DBConnect.

  1. Enter the information of the file, and then click Next.
  2. Select Persistance to enable history data storage, and then click Save.
info

By default, supOS generates a data flow with mock data in UNS > SourceFlow and a dashboard in System > Dashboards.

Generating Data Models through JSON

  1. Click on the Model tab.
  2. Select the data type, and then write JSON text for the data model.
info

We will build a similar model for reference.

{
"Factory1": {
"workshop1": {
"equipment1": {
"CNC1": [
{
"actualRuntime1": 1380,
"plannedRuntime1": 1440
}
]
}
}
}
}
  1. Click Next, and select the model on the left side.
tip

Click on each data level, you can change its information and add attributes on the right side.

  1. Click Save.

Building Template

  1. On the Namespace page, click Template.
  2. Click , and then enter the information of the template.
tip

Click Source to select added models and inherit their attributes.

  1. Click Save.